
package fr.enseirbmatmeca.apms.tapestry.components;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.springframework.security.cas.web.CasAuthenticationEntryPoint;

public class CasLogin {
	@Inject
	private CasAuthenticationEntryPoint casProcessingFilterEntryPoint;
	
	// construct UrL of the CAS server to contact
	
	public String getCasLoginUrl() {
		String casServer = casProcessingFilterEntryPoint.getLoginUrl();
		StringBuilder sb = new StringBuilder(casServer);
		if(!casServer.endsWith("/")) {
			sb.append("/");
		}
		sb.append("?service=");
		sb.append(casProcessingFilterEntryPoint.getServiceProperties().getService());
		return sb.toString();
	}

}
